package main

import (
	"fmt"
	"io"
	"os"
)
import "net/http"

func hello(w http.ResponseWriter, r *http.Request) {
	host, _ := os.Hostname()
	dbURL := os.Getenv("DB_URL")
	io.WriteString(w, fmt.Sprintf("[v3] Hello World, Kubernetes!, from host: %s,get database connect url: %s", host, dbURL))
}

func main() {
	http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusOK)
		w.Write([]byte("OK"))
	})
	http.HandleFunc("/", hello)
	http.ListenAndServe(":3000", nil)
}
